/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package conn.dao;

import com.mysql.jdbc.Statement;
import conn.bean.BTipoLinea;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author An6ela
 */
public class DTipoLinea extends DBase {


    public List getmodtipolinea() {
        List Lista = new ArrayList();
        Statement stmt = null;
        ResultSet res = null;
        BTipoLinea btipolinea = null;


        this.init_mysql();  // se inicia la conección a la base de datos

        try {
            stmt = (Statement) conn.createStatement();
            res = stmt.executeQuery(
                    "select idTipoLinea, nombre from tipolinea");

            while (res.next()) {


                btipolinea = new BTipoLinea(res.getInt(1), res.getString(2));

                Lista.add(btipolinea);
            }
            res.close();
            stmt.close();
            conn.close();
        } catch (SQLException ex) {
            System.out.println("SqlException : " + ex.toString());
        } catch (Exception ex) {
            System.out.println("Exception : " + ex.toString());
        } finally {
            if (res != null) {
                try {
                    res.close();
                } catch (SQLException e) {
                    ;
                }
                res = null;
            }
            if (stmt != null) {
                try {
                    stmt.close();
                } catch (SQLException e) {
                    ;
                }
                stmt = null;
            }
            if (conn != null) {
                try {
                    conn.close();
                } catch (SQLException e) {
                    ;
                }
                conn = null;
            }
        }
        return Lista;
    }

}
